package com.spring.picture.controller;

import com.github.benmanes.caffeine.cache.Cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/cache")
public class CacheController {

    // 本地缓存
    @Autowired
    private Cache<String,String> LOCAL_CACHE;

    @GetMapping("/getAll")
    public String getAll() {
        return LOCAL_CACHE.asMap().keySet().toString();
    }

    @DeleteMapping("/deleteAll")
    public void deleteAll() {
        LOCAL_CACHE.asMap().keySet().clear();
    }
}
